package string;

import org.openjdk.jol.vm.VM;

public class StringTest {
    public static void main(String[] args) {
        String str0 = "abc";
        String str1 = "abc";
        String str2 = new String("abc");
        String str3 = new String("abc");

        System.err.println("str0 == str1 = " + (str0 == str1));
        System.err.println("str0 == str2 = " + (str0 == str2));
        System.err.println("str2 == str3 = " + (str2 == str3));

        System.err.println("str0's address = " + VM.current().addressOf(str0));
        System.err.println("str1's address = " + VM.current().addressOf(str1));
        System.err.println("str2's address = " + VM.current().addressOf(str2));
        System.err.println("str3's address = " + VM.current().addressOf(str3));
    }
}
